const nodemailer = require("nodemailer");

const transporter = nodemailer.createTransport({
  service: "QQ",
  port: 465,
  secure: true,
  auth: {
    user: "hd76@qq.com",
    pass: "urwzwwanycspbdfj",
  },
});

module.exports = function (text) {
  const mailOptions = {
    from: `"henry" <hd76@qq.com>`,
    to: "896186511@qq.com",
    subject: "忘打卡提醒",
    text: "兄弟, 你昨天忘打卡咯!",
    html: `<div>
            <h1>兄弟, 你昨天忘打卡咯!</h1>
            <pre>
                ${text}
            </pre>
        </div>`,
  };
  transporter.sendMail(mailOptions, (error, info) => {
    if (error) {
      console.error("发送邮件时出错:", error);
      return;
    }
    console.log("邮件发送成功:", info);
  });
};
